package com.sunqizhong.mapper;

import com.sunqizhong.entity.Student;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface StudentMapper {

    /*
    * 查询总记录数
    * */
    @Select("select count(*) from student s left join clazz c on s.clazz_id = c.id")
    public Long count();
    /*
    * 查询所有的员工及其对应的部门名称
    * */
    //@Select("select s.*,c.name clazzName from student as s left join clazz as c on s.clazz_id = c.id limit #{start},#{pageSize}")
    public List<Student> list(Student param);

    /*
    * 添加员工
    * */
    @Insert("insert into student(name,no,gender,phone,id_card,is_college,address,degree,graduation_date,clazz_id)\n" +
            "values (#{name},#{no},#{gender},#{phone},#{idCard},#{isCollege},#{address},#{degree}," +
            "#{graduationDate},#{clazzId})")
    void insert(Student student);


    /*
    * 根据i批量删除学员
    * */
    void deleteByIds(Integer[] ids);
}
